package com.cls.business.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cls.common.annotation.DecryptField;
import com.cls.common.annotation.EncryptDecryptEntity;
import com.cls.common.annotation.EncryptField;
import com.cls.common.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
/**
 * 申请人信息表 Entity
 *
 * @author wandering
 * @date 2020-11-11 18:15:13
 */
@Data
@TableName("biz_applicant_info")
@EncryptDecryptEntity
public class ApplicantInfo extends BaseEntity implements Serializable {



    /**
     * 申请人id
     */
    @TableId(value = "applicant_id", type = IdType.AUTO)
    private Long applicantId;



    /**
     * 姓名
     */
    @TableField("name")
    private String name;


    /**
     * 工作单位
     */
    @TableField("company")
    private String company;


    /**
     * 身份证号
     */
    @TableField("identity")
    @DecryptField
    @EncryptField
    private String identity;


    /**
     * 性别
     */
    @TableField("sex_type_code")
    private String sexTypeCode;


    /**
     * 证件类型号
     */
    @TableField("identity_type_code")
    private String identityTypeCode;


    /**
     * 民族
     */
    @TableField("nation_type_code")
    private String nationTypeCode;



    /**
     * 政治面貌
     */
    @TableField("political_type_code")
    private String politicalTypeCode;



    /**
     * 外语语种
     */
    @TableField("language")
    private String language;
    /**
     * 人事关系所在地
     */
    @TableField("personnel_area_type_code")
    private String personnelAreaTypeCode;

    /**
     * 行政职务
     */
    @TableField("position_type_code")
    private String positionTypeCode;


    /**
     * 职称
     */
    @TableField("title_type_code")
    private String titleTypeCode;


    /**
     * 学位
     */
    @TableField("degree_type_code")
    private String degreeTypeCode;
    /**
     * 职业
     */
    @TableField("profession_code")
    private String professionCode;


    /**
     * 单位地址
     */
    @TableField("company_address")
    private String companyAddress;


    /**
     * 邮政编码
     */
    @TableField("post_code")
    private String postCode;


    /**
     * 出生年月
     */
    @TableField("birthday")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birthday;


    /**
     * 担任导师
     */
    @TableField("tutor_type_code")
    private String tutorTypeCode;


    /**
     * 通讯地址
     */
    @TableField("address")
    private String address;


    /**
     * 联系电话
     */
    @TableField("telephone")
    private String telephone;


    /**
     * 移动电话 手机号
     */
    @TableField("mobile")
    @DecryptField
    @EncryptField
    private String mobile;

    /**
     * 电子邮箱
     */
    @TableField("email")
    @DecryptField
    @EncryptField
    private String email;


    /**
     * 研究领域
     */
    @TableField("field")
    private String field;

    /**
     *
     */
    @TableField("user_id")
    private Long userId;


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ApplicantInfo that = (ApplicantInfo) o;

        return new EqualsBuilder()
                .appendSuper(super.equals(o))
                .append(applicantId, that.applicantId)
                .append(name, that.name)
                .append(company, that.company)
                .append(identity, that.identity)
                .append(sexTypeCode, that.sexTypeCode)
                .append(nationTypeCode, that.nationTypeCode)
                .append(politicalTypeCode, that.politicalTypeCode)
                .append(language, that.language)
                .append(positionTypeCode, that.positionTypeCode)
                .append(titleTypeCode, that.titleTypeCode)
                .append(degreeTypeCode, that.degreeTypeCode)
                .append(professionCode, that.professionCode)
                .append(companyAddress, that.companyAddress)
                .append(postCode, that.postCode)
                .append(birthday, that.birthday)
                .append(tutorTypeCode, that.tutorTypeCode)
                .append(address, that.address)
                .append(telephone, that.telephone)
                .append(mobile, that.mobile)
                .append(email, that.email)
                .append(field, that.field)
                .append(userId, that.userId)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .appendSuper(super.hashCode())
                .append(applicantId)
                .append(name)
                .append(company)
                .append(identity)
                .append(sexTypeCode)
                .append(nationTypeCode)
                .append(politicalTypeCode)
                .append(language)
                .append(positionTypeCode)
                .append(titleTypeCode)
                .append(degreeTypeCode)
                .append(professionCode)
                .append(companyAddress)
                .append(postCode)
                .append(birthday)
                .append(tutorTypeCode)
                .append(address)
                .append(telephone)
                .append(mobile)
                .append(email)
                .append(field)
                .append(userId)
                .toHashCode();
    }
}
